﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;

namespace DryWCS.App.ViewModel
{
    public class Cell : Button
    {
        /// <summary>
        /// 渲染坐标X
        /// </summary>
        public int X { get; set; }

        /// <summary>
        /// 渲染坐标Y
        /// </summary>
        public int Y { get; set; }

        /// <summary>
        /// 层号
        /// </summary>
        public int LayerNo { get; set; }

        /// <summary>
        /// 列号
        /// </summary>
        public int ColNo { get; set; }

        /// <summary>
        /// 排号
        /// </summary>
        public int LineNo { get; set; }

        /// <summary>
        /// 巷道号
        /// </summary>
        public int LaneNo { get; set; }

        /// <summary>
        /// 库位序号
        /// </summary>
        public int No { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="lineNo">排号</param>
        /// <param name="width">宽度</param>
        /// <param name="height">高度</param>
        /// <param name="x">坐标x</param>
        /// <param name="y">坐标y</param>
        public Cell(string data, float width, float height, int x, int y)
        {
            Width = width;
            Height = height;
            X = x;
            Y = y;

            this.Background = Brushes.DarkOrange;
            this.SetBinding(Button.BackgroundProperty, new Binding() { Path = new PropertyPath($"{data}[{Y}].Columns[{X}].CellBg") });

            this.SetBinding(Button.CommandProperty, new Binding() { Path = new PropertyPath("CellCommand") });
            this.SetBinding(Button.CommandParameterProperty, new Binding() { Path = new PropertyPath($"{data}[{Y}].Columns[{X}]") });

            this.BorderThickness = new Thickness(1);
            this.BorderBrush = Brushes.White;
        }



    }
}
